home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / pd / daten / quickfile / arexx / demo.rexx < prev    next >
OS/2 REXX Batch file  |  1995-07-22  |  4KB  |  164 lines

  1. /*
  2.     Demo ARexx script for QuickFile
  3.  
  4.     Author: Alan Wigginton
  5.     Date:   21 March 1995
  6. */
  7.  
  8. options results     /* required to make result string available */
  9.  
  10. if ~open("con","CON:20/10/400/100/ARexx/CLOSE","W") then
  11.     exit 20
  12.  
  13. call writeln("con", "QuickFile ARexx script demo")
  14. call writeln("con", "This requires that QuickFile be running with")
  15. call writeln("con", "the demo AddressBook file open. If necessary")
  16. call writeln("con", "open the file now")
  17. call writeln("con", "Enter y to continue, anything else to end")
  18. if upper(readln("con")) ~= "Y" then
  19.     exit
  20.  
  21. if ~show(ports,"QUICKFILE.01") then
  22.     call ErrorProc "QuickFile.01 port not found"
  23.  
  24. address "QUICKFILE.01"
  25.  
  26. "setfile AddressBook"
  27. "wintofront"        /* make sure user can see the window */
  28.  
  29. /*
  30.     Display a simple message in a requester
  31.     --------------------------------------
  32. */
  33.  
  34. "reqmsg 'OK - Lets load a list style view'"
  35.  
  36. /*
  37.     Load a new view and redraw display according to the view
  38.     --------------------------------------------------------
  39. */
  40.  
  41. "setview"
  42. if result ~= "AddrList.view" then
  43. do
  44.     "setview AddrList.view"
  45.     if rc = 5 then
  46.     do
  47.     "loadview AddrList.view"
  48.     if rc > 0 then
  49.         call ErrorProc "Error loading AddrList.view"
  50.     "setview AddrList.view"
  51.     end
  52. end
  53.  
  54. "reqmsg 'Few database programs have a good list display'"
  55.  
  56. /*
  57.     Here is a simple search of the database. The matching records
  58.     are placed in an index named 'Selected'
  59.     The 'refresh' command causes an immediate redraw of the display.
  60.     Without it, the display is not updated until the macro finishes
  61. */
  62.  
  63. "reqmsg 'Now lets find all the Smiths using sounds like'"
  64.  
  65. "newsearch Lastname sounds smith"        /* set search criteria  */
  66. "dosearch"                              /* find all the records */
  67. numfound   = result            /* returns number found */
  68. "setindex selected"                     /* Use the selected index */
  69. "refresh"
  70.  
  71. /* sends reqmsg 'We found x Smiths' to QuickFile */
  72. /* quotes can be tricky         */
  73.  
  74. "reqmsg 'We found" numfound "names that sound like Smith'"
  75.  
  76. "reqmsg 'Now a sort over country and name'"
  77. "setindex name"             /* swap back to a full list */
  78. "sort country a lastname a firstname a"
  79. "refresh"                   /* and show the result  */
  80. "reqmsg 'Here is the sorted list'"
  81.  
  82. /*
  83.     Now lets do some printing
  84.     -------------------------
  85. */
  86.  
  87. "reqmsg 'This counts records by country - full report'"
  88. "next -9999"
  89. "report -1 screen 'This title inserted from ARexx'"
  90.  
  91. /*
  92.     Select Summary only view and print report
  93. */
  94.  
  95. "next -9999"
  96. "reqmsg 'Now a Count by country using Summary Only option'"
  97. "setview SummOnly.view"
  98. if rc = 5 then
  99. do
  100.     "loadview SummOnly.view"
  101.     if rc > 0 then
  102.     call ErrorProc "Error loading SummOnly.view"
  103.     "setview SummOnly.view"
  104. end
  105. "report -1 screen"
  106.  
  107. /*
  108.     Field wrap example
  109. */
  110.  
  111. "next -9999"
  112. "reqmsg 'and now for field wrapping'"
  113. "setview FieldWrap.view"
  114. if rc = 5 then
  115. do
  116.     "loadview FieldWrap.view"
  117.     if rc > 0 then
  118.     call ErrorProc "Error loading FieldWrap.view"
  119.     "setview FieldWrap.view"
  120. end
  121.  
  122. "report -1 screen"
  123.  
  124. /*
  125.     Label print example
  126. */
  127.  
  128. "setindex name"
  129.  
  130. "reqmsg 'Now some address labels'"
  131. "setview AddrLabels.view"
  132. if rc = 5 then
  133. do
  134.     "loadview AddrLabels.view"
  135.     if rc > 0 then
  136.     call ErrorProc "Error loading AddrLabels.view"
  137.     "setview AddrLabels.view"
  138. end
  139.  
  140.  
  141. "next -9999"
  142. "report -1 screen"
  143.  
  144. "reqchoice 'This is a choice requester' 'Press a button'"
  145. if rc = 5 then
  146.     "reqmsg 'You chose Cancel'"
  147. else
  148.     "reqmsg 'You chose OK'"
  149.  
  150. "reqmsg 'Thats all. I hope you like it'"
  151. exit
  152.  
  153. ErrorProc:
  154.  
  155. arg msg
  156.  
  157. call writeln("con", msg)
  158. call writeln("con", "Press return to continue")
  159. call readln("con")
  160. exit
  161.  
  162.  
  163.  
  164.